/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package z.h.w.jar.kit.method;

import java.lang.reflect.Array;
import java.util.UUID;

/**
 *
 * @author EnzoZhong
 * @date 2011-11-11
 */
public class Maker {

      /**
       *
       */
      final private static String[] COGNOME_CH = {
            "白" , "陈" , "蔡" , "晨" , "邓" , "丁" , "董" , "都" , "范" , "冯" ,
            "封" , "葛" , "方" , "练" , "郭" , "韩" , "黄" , "吴" , "钟" };
      /**
       *
       */
      final private static String[] NAME_CH = {
            "雪" , "家伟" , "旭" , "曦" , "艳" , "力" , "春华" , "超" , "伟琪" ,
            "史凯" , "悦宁" , "文瑶" , "力生" , "俞静" , "景" , "盈" , "迪" , "浩文" };

      /**
       *
       * @return
       */
      public static String makeRamdomCognome () {
            return Roll.roll ( COGNOME_CH );
      }

      /**
       *
       * @return
       */
      public static String makeRamdomName () {
            return Roll.roll ( NAME_CH );
      }

      /**
       * 生成UUID
       * <p/>
       * @return
       */
      public static synchronized String makeUUID () {
            return UUID.randomUUID ().toString ().replaceAll ( "-" , "" );
      }

      /**
       * 生成当时时刻的LongId
       * <p/>
       * @return
       */
      public static synchronized Long makeLongId () {
            try {
                  Thread.sleep ( 1 );
                  return System.currentTimeMillis ();
            } catch ( InterruptedException ex ) {
                  return null;
            }
      }

      /**
       * 生成范型数组
       * <p/>
       * @param <T> m clazz size
       * <p/>
       * @param clazz
       * @param size
       * @return
       */
      @SuppressWarnings ( "unchecked" )
      public static synchronized <T> T[] makeArray ( Class<?> clazz , Integer size ) {
            return ( T[] ) Array.newInstance ( clazz , size );
      }

}
